package com.order.orderback.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.order.orderback.entity.SwiperImages;
import com.order.orderback.mapper.SwiperImagesMapper;
import com.order.orderback.service.SwiperImagesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SwiperImagesServiceImpl implements SwiperImagesService {

    @Autowired
    private SwiperImagesMapper swiperImagesMapper;

    @Override
    public List<SwiperImages> getSwiperImagesByStoreId(Integer storeId) {
        QueryWrapper<SwiperImages> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("store_id", storeId);
        queryWrapper.orderByAsc("sort_order");
        return swiperImagesMapper.selectList(queryWrapper);
    }

    @Override
    public int addSwiperImage(SwiperImages swiperImages) {
        return swiperImagesMapper.insert(swiperImages);
    }
}
